<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <meta charset="UTF-8">
    <head th:replace="fragments::header"/>
    <div th:replace="fragments::bootStrap"></div>
    <title>[[${title}]]</title>
</head>
<body class="landing">
<div id="page-wrapper">
    <div class="container" style="padding-top: 50px;">
        <p th:if="${message} ne null" th:text="${message}" class="text-danger text-center"></p>
        <form class="form-horizontal" th:action="${insert}?@{/reportTemplate/insert}:@{/reportTemplate/update}"
              th:method="post">
            <div class="form-group">
                <input type="hidden" name="templateId" th:if="!${insert}" th:value="${template.templateId}">
                <label for="inputTemplateName" class="col-sm-2 control-label">模板名称</label>
                <div class="col-sm-10">
                    <input type="text" name="templateName" th:value="${template.templateName}"
                           class="form-control" id="inputTemplateName" placeholder="请输入模板名称">
                </div>
            </div>
            <div class="form-group">
                <label for="selectTemplateType" class="col-sm-2 control-label">模板类型</label>
                <div class="col-sm-10">
                    <select name="templateType" class="form-control" id="selectTemplateType" required>
                        <option th:selected="${template.templateType=='html'}" selected value="html">html</option>
                        <option th:selected="${template.templateType=='doc'}" value="doc">doc</option>
                        <option th:selected="${template.templateType=='docx'}" value="docx">docx</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="selectTemplateModel" class="col-sm-2 control-label">模板形式</label>
                <div class="col-sm-10">
                    <select name="templateModel" class="form-control" id="selectTemplateModel" required>
                        <option th:selected="${template.templateModel=='upload'}" value="upload">upload</option>
                        <option th:selected="${template.templateModel=='online'}" selected value="online">online
                        </option>
                    </select>
                </div>
            </div>
            <div class="form-group" th:if="${template.templateModel} ne 'upload'">
                <label for="inputTemplatePath" class="col-sm-2 control-label">模板路径</label>
                <div class="col-sm-10">
                    <input type="file" name="subject" th:value="${template.templatePath}"
                           class="form-control" id="inputTemplatePath" placeholder="请输入模板路径">
                </div>
            </div>
            <div class="form-group">
                <label for="inputRemark" class="col-sm-2 control-label">备注</label>
                <div class="col-sm-10">
            <textarea name="remark" class="form-control"
                      th:utext="${template.remark}" rows="5"
                      id="inputRemark" placeholder="请输入备注"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label for="inputTemplateContent" class="col-sm-2 control-label">模板内容</label>
                <div class="col-sm-10">
            <textarea name="templateContent" class="form-control"
                      th:utext="${template.templateContent}" rows="5"
                      id="inputTemplateContent" placeholder="请输入模板内容"></textarea>
                </div>
            </div>
            <div class="form-group pull-right">
                <button type="submit" class="btn btn-info" th:text="${insert}?'添加':'更新'">发送</button>
                <a type="button" th:href="@{/reportTemplate}" th:if="${!insert}" class="btn btn-default">返回</a>
                <a type="button" th:href="@{/reportTemplate}" th:if="${insert}" class="btn btn-default">取消</a>
            </div>
        </form>
    </div>
</div>
<div th:replace="fragments::foot"></div>
</body>
</html>